package com.qf.Service.Impl;


import com.qf.Dao.Impl.UserDaoImpl;
import com.qf.Dao.UserDao;
import com.qf.Entity.User;
import com.qf.Service.UserService;
import com.qf.Util.DruidUtil;

/*2021/10/9*/public class UserServiceImpl implements UserService {
    UserDao userDao =new UserDaoImpl();
    @Override
    public User loginUser(String uAccount, String uPassword) {
        User user = null;
        try {
            user =userDao.selectUser(uAccount);
            if(user.getuPassword().equals(uPassword)){
                return user;
            }
        } finally {
        DruidUtil.close();
        }
        return null;
    }

    @Override
    public Integer updatePassword(String uAccount, String uPassword) {
        Integer result=0;
        try {
            DruidUtil.begin();
            result = userDao.updatePassword(uAccount, uPassword);
            DruidUtil.commit();
        } catch (Exception e) {
            e.printStackTrace();
            DruidUtil.rollback();
        } finally {
            DruidUtil.close();
        }
        return result;
    }
}
